Skip to content

feat(english/fenrirrealm): add fetchViaWebview fallback for chapter loading - #2904

Merged
rajarsheechatterjee merged 2 commits into
lnreader:masterfrom
7ui77:feat/fenrir-hidden-webview
Nov 15, 2026
Merged

rajarsheechatterjee merged 2 commits into
lnreader:masterfrom
7ui77:feat/fenrir-hidden-webview

Conversation

@7ui77

@7ui77 7ui77 commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Checklist

  • Update version code if an existing plugin was modified
  • Test changes in Plugin Playground or the app
  • Reference related issues in the PR body (e.g. Closes #xyz)
  • Commit messages follow type(scope): description (e.g. feat(<generator>): add new source)

Closes #2900
Closes #2846

Depends on lnreader/lnreader#2128 (@libs/fetch.fetchViaWebview).

Summary

Adds a fetchViaWebview fallback to plugins/english/fenrirrealm.ts (bumped to 1.2.0) when API token minting or chapter fetching fails (403, 401, 503, locked, or empty SSR HTML), and scopes DOM extraction to the actual chapter prose container.

parseChapter(chapterPath)
  ├─ API fetch / mintReadToken succeeds -> formatChapterContent()
  ├─ 403 / 401 / 503 / locked -> fetchViaWebviewOrThrow(chapterPath)
  │    ├─ fetchViaWebview(url, { waitForSelector: readerParagraphSelector })
  │    ├─ extractChapterHtml(res.html) (rejects "Confirm you're human" gate on raw body)
  │    └─ if null -> throw verifyInWebViewError(...)
  └─ HTML fallback -> extractChapterHtml() -> fetchChapterViaWebview() -> SvelteKit JSON

Evidence

  • Before: fetchApi returned 403 challenge_required / locked because Fenrir Realm stores its read token in JS memory rather than cookies; early DOM matching also risked picking up #reader-area UI chrome (One long scroll..., Meet the author).
  • After:
    • pnpm run build:compile, npx eslint plugins/english/fenrirrealm.ts, npx prettier --check plugins/english/fenrirrealm.ts: 0 errors.
    • Tested in preview APK (https://github.com/lnreader/lnreader/pull/2128) on Android device (Pixel_4, 127.168.1.1:10001): HiddenWebView executed and extracted rendered DOM; interactive human-verification gates still cleanly prompt WebView verification instead of saving gate text as chapter content.

Merge Danger

Door: two-way

Additive fallback guarded by typeof fetchViaWebview === 'function'; older app versions without fetchViaWebview fall back to the existing verifyInWebViewError.

Blast Radius: low

Scoped strictly to plugins/english/fenrirrealm.ts.

@7ui77
7ui77 marked this pull request as ready for review November 15, 2026 14:28
@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge with its documented companion app dependency.

Summary

Adds an optional WebView fallback for Fenrir Realm chapter loading and raises version to 1.2.0.

  • Fenrir Realm can load chapter text from a rendered page.

7ui77 explicitly identifies the companion app change as a dependency and older-app fallback behavior as intentional.

Reviews (1) · Last reviewed commit: "fix(english/fenrirrealm): address review..." · Reviewed by Greptile

@rajarsheechatterjee
rajarsheechatterjee merged commit 89c109a into lnreader:master Nov 15, 2026
4 checks passed
@7ui77
7ui77 deleted the feat/fenrir-hidden-webview branch November 15, 2026 15:15
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

2 participants